<!DOCTYPE html>
<html lang="zh-cn">
   <head>
      <meta charset="utf-8">
      <meta http-equiv="X-UA-Compatible" content="IE=edge">
      <meta name="viewport" content="width=device-width, initial-scale=1">
      <title>{$CONF['mallTitle']}后台管理中心</title>
      <link href="__PUBLIC__/plugins/bootstrap/css/bootstrap.min.css" rel="stylesheet">
      <link href="__ROOT__/Apps/Admin/View/css/AdminLTE.css" rel="stylesheet" type="text/css" />
      <!--[if lt IE 9]>
      <script src="__PUBLIC__/js/html5shiv.min.js"></script>
      <script src="__PUBLIC__/js/respond.min.js"></script>
      <![endif]-->
      <script src="__PUBLIC__/js/jquery.min.js"></script>
      <script src="__PUBLIC__/plugins/bootstrap/js/bootstrap.min.js"></script>
      <script src="__PUBLIC__/js/common.js"></script>
      <script src="__PUBLIC__/plugins/plugins/plugins.js"></script>
   </head>
   <script>
   function toggleStatus(t,v){
	   Plugins.waitTips({title:'信息提示',content:'正在操作，请稍后...'});
	   $.post("{:U('Admin/Staffs/editStatus')}",{id:v,staffStatus:t},function(data,textStatus){
			var json = WST.toJson(data);
			if(json.status=='1'){
				Plugins.setWaitTipsMsg({content:'操作成功',timeout:1000,callback:function(){
				    location.reload();
				}});
			}else{
				Plugins.closeWindow();
				Plugins.Tips({title:'信息提示',icon:'error',content:'操作失败!',timeout:1000});
			}
	   });
   }
   function del(id){
	   Plugins.confirm({title:'信息提示',content:'您确定要删除该职员吗?',okText:'确定',cancelText:'取消',okFun:function(){
		   Plugins.closeWindow();
		   Plugins.waitTips({title:'信息提示',content:'正在操作，请稍后...'});
		   $.post("{:U('Admin/Staffs/del')}",{id:id},function(data,textStatus){
					var json = WST.toJson(data);
					if(json.status=='1'){
						Plugins.setWaitTipsMsg({content:'操作成功',timeout:1000,callback:function(){
						   location.reload();
						}});
					}else{
						Plugins.closeWindow();
						Plugins.Tips({title:'信息提示',icon:'error',content:'操作失败!',timeout:1000});
					}
				});
	   }});
   }
   </script>
   <body class='wst-page'>
     <form method='post' action="{:U('Admin/Staffs/index')}">
       <div class='wst-tbar'> 
       账号：<input type='text' id='loginName' name='loginName' class='form-control wst-ipt-10' value='{$loginName}'/> 
       姓名：<input type='text' id='staffName' name='staffName' class='form-control wst-ipt-10' value='{$staffName}'/>   
  <button type="submit" class="btn btn-primary glyphicon glyphicon-search">查询</button> 
       <php>if(in_array('zylb_01',$WST_STAFF['grant'])){</php>
       <a class="btn btn-success glyphicon glyphicon-plus" href="{:U('Admin/Staffs/toEdit')}" style='float:right'>新增</a>
       <php>}</php>
       </div>
       </form>
       <div class="wst-body">
        <table class="table table-hover table-striped table-bordered wst-list">
           <thead>
             <tr>
               <th width='30'>序号</th>
               <th width='80'>账号</th>
               <th width='80'>姓名</th>
               <th width='80'>角色</th> 
               <th width='60'>编号</th>
               <th width='60'>工作状态</th>
               <th width='120'>最后登录时间</th>
               <th width='80'>最后登录IP</th>
               <th width='40'>状态</th>
               <th width='120'>操作</th>
             </tr>
           </thead>
           <tbody>
            <volist name="Page['root']" id="vo" key='i'>
             <tr>
               <td>{$i}</td>
               <td>{$vo['loginName']}</td>
               <td>{$vo['staffName']}&nbsp;</td>
               <td>{$vo['roleName']}&nbsp;</td>
               <td>{$vo['staffNo']}&nbsp;</td>
               <td>
               <if condition="$object['workStatus'] ==1 ">在职</if>
               <if condition="$object['workStatus'] ==0 ">在职</if>&nbsp;
               </td>
               <td>{$vo['lastTime']}&nbsp;</td>
               <td>{$vo['lastIP']}&nbsp;</td>
               <td>
               <div class="dropdown">
               <if condition="$vo['staffStatus']==0 ">
                   <button class="btn btn-danger dropdown-toggle wst-btn-dropdown"  type="button" data-toggle="dropdown">
					    停用
					  <span class="caret"></span>
				   </button>
               <else/>
                   <button class="btn btn-success dropdown-toggle wst-btn-dropdown" type="button" data-toggle="dropdown">
					     启用
					  <span class="caret"></span>
				   </button>
               </if>
               <php>if(in_array('zylb_02',$WST_STAFF['grant'])){</php>
                   <ul class="dropdown-menu" role="menu">
					  <li role="presentation"><a role="menuitem" tabindex="-1" href="javascript:toggleStatus(1,{$vo['staffId']})">显示</a></li>
					  <li role="presentation"><a role="menuitem" tabindex="-1" href="javascript:toggleStatus(0,{$vo['staffId']})">隐藏</a></li>
				   </ul>
				<php>}</php>
               </div>
               </td>
               <td>
               <php>if(in_array('zylb_02',$WST_STAFF['grant'])){</php>
               <a class="btn btn-default glyphicon glyphicon-pencil" href="{:U('Admin/Staffs/toEdit',array('id'=>$vo['staffId']))}">修改</a>&nbsp;
               <php>}</php>
               <php>if(in_array('zylb_03',$WST_STAFF['grant'])){</php>
               <if condition="$vo['staffId'] != $Think.session.STAFF.staffId ">
               <button type="button" class="btn btn-default glyphicon glyphicon-trash" onclick="javascript:del({$vo['staffId']})">刪除</buttona>
               </if>
               <php>}</php>
               </td>
             </tr>
             </volist>
             <tr>
                <td colspan='11' align='center'>{$Page['pager']}</td>
             </tr>
           </tbody>
        </table>
       </div>
   </body>
</html>